<template>
  <page-body>
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center newPhonePass_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub newPhonePass_fd0_0'>
          <view class='flex flex-wrap align-center newPhonePass_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="switchTab" :data-url="`/pages/tabBar/mine/mine`">
            <text class='fu-iconfont2  newPhonePass_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='newPhonePass_fd0_0_c1_c0'>修改密码</text>
          </view>
          <view class='flex flex-wrap align-center justify-end newPhonePass_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout newPhonePass_flex_1">
        <view class='flex flex-direction flex-wrap align-stretch flex-sub newPhonePass_fd1_0'>
          <view class='flex flex-wrap align-center justify-between flex-sub newPhonePass_fd1_0_c0'>
            <text class='newPhonePass_fd1_0_c0_c0'>新密码：</text>
            <benben-input class='newPhonePass_fd1_0_c0_c1' type="text" :placeholder="`请输入新密码`" confirm-type="done"
              :maxlength="-1" :adjust-position='true' placeholder-style="color:rgba(162, 162, 162, 1);font-size:28rpx"
              v-model="pass" />
          </view>
          <view class='flex flex-wrap align-center justify-between flex-sub newPhonePass_fd1_0_c1'>
            <text class='newPhonePass_fd1_0_c0_c0'>确认新密码：</text>
            <benben-input class='newPhonePass_fd1_0_c0_c1' type="text" :placeholder="`请再次输入新密码`" confirm-type="done"
              :maxlength="-1" :adjust-position='true' placeholder-style="color:rgba(162, 162, 162, 1);font-size:28rpx"
              v-model="newpass" />
          </view>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <view class="flex flex-direction flex-wrap align-center benben-position-layout flex newPhonePass_flex_2"
        :style="{height:(150+bottomSafeAreaRpx)+'rpx',paddingBottom:bottomSafeAreaRpx+'rpx', }">
        <button class='newPhonePass_fd2_0' @tap.stop="getgcda9ab4c4c7afFunc()">完成</button>

      </view>
      <view :style="{height: (150+bottomSafeAreaRpx)+'rpx'}"></view>


    </view>
  </page-body>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "pass": "",
        "newpass": ""
      };
    },
    computed: {

    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //设置中心-用旧密码重置密码
      async getgcda9ab4c4c7afFunc() {
		
        if (!validate(this.pass, 'require')) {
          this.$message.info('密码不能为空');
          return false;
        }
		if (!validate(this.newpass, 'require')) {
		  this.$message.info('确认密码不能为空');
		  return false;
		}
        if (this.pass != this.newpass) {
          this.$message.info('密码不一致');
          return false;
        }
        //请求方法
        //数据验证
		
        let data5da9ab4c4c7af = await this.$api.post(global.apiUrls.post5da9ab4c4c7af, {
		 // account:uni.getStorageSync('USER_INFO').phone,
		 //  type: '2',
		 //  account_type: 'mobile',
          password: this.pass,
          password_code: this.newpass,
        });

        if (data5da9ab4c4c7af.data.code != 1) {
          this.$message.info(data5da9ab4c4c7af.data.msg);
          return
        }
        let info5da9ab4c4c7af = data5da9ab4c4c7af.data;


      this.$message.info('修改成功')
      setTimeout(() => {
      	this.$store.commit('logout')
      	this.toLoginDiy();
      }, 800)
        
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F6f6f6;
    background-size: 100% auto;
  }

  .newPhonePass_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .newPhonePass_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .newPhonePass_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .newPhonePass_fd0_0_c0 {
    width: 120rpx;
  }

  .newPhonePass_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .newPhonePass_flex_1 {
    padding: 24rpx;
  }

  .newPhonePass_fd1_0_c1 {
    width: 100%;
    height: 200rpx;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .newPhonePass_fd1_0_c0_c1 {
    text-align: right;
  }

  .newPhonePass_fd1_0_c0_c0 {
    font-size: 32rpx;
    line-height: 45rpx;
    color: rgba(51, 51, 51, 1);
  }

  .newPhonePass_fd1_0_c0 {
    border-bottom: 1px solid rgba(238, 238, 238, 1);
    width: 100%;
    height: 200rpx;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .newPhonePass_fd1_0 {
    background: #Fff;
    border-radius: 16rpx;
    background-size: 100% auto;
    padding: 0rpx 024rpx 0rpx 024rpx;
  }

  .newPhonePass_flex_2 {
    width: 750rpx;
    height: 150rpx;
    overflow: hidden;
    z-index: 10;
    bottom: calc(0rpx + var(--window-bottom));
  }

  .newPhonePass_fd2_0 {
    background:#145efd;
    border-radius: 45rpx;
    width: 638rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    height: 88rpx;
  }
</style>
